package love.unknown.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

//目标：和数据库建立连接
public class Demo01 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        //1.添加jar
        //2.加载驱动
        Class.forName("com.mysql.jdbc.Driver");
        //3.通过驱动管理器获取连接对象
        String url = "jdbc:mysql://192.168.108.129:3306/fruitdb?characterEncoding=utf-8";
        String user = "root";
        String password = "123456";
        Connection conn = DriverManager.getConnection(url,user,password);
        System.out.println("conn="+conn);

    }


}
